home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / os2 / wuz11a.zip / ZIP-DIR.CMD < prev    next >
OS/2 REXX Batch file  |  1994-01-25  |  2KB  |  61 lines

  1. /* Move entire folder into a ZIP file of the same name */
  2. /* (c) Copyright 1993 Scott Maxwell.*/
  3.  
  4. IconPath = 'E:\My_OS2\'
  5.  
  6. arg Name
  7.  
  8. OriginalName = Name
  9.  
  10. if Name = '' then do
  11. Usage:
  12.   say "USAGE: Zip-Dir directory-name"
  13.   say "  Moves the contents of the specified directory into a ZIF file in"
  14.   say "  the same directory.  The purpose of this command is to compress"
  15.   say "  entire directories that you are not currently using.  To restore"
  16.   say "  the directory, simply double-click on the ZIF file or drag-and-"
  17.   say "  drop the ZIF file or the directory onto your WPS Unzip icon."
  18.   '@pause'
  19.   exit(0)
  20.   end
  21.  
  22. Dir.1 = DIRECTORY()
  23. Dir.2 = ''
  24. if SubStr(Name,2,1) = ':' then do
  25.   Dir.2 = DIRECTORY(Left(Name,2))
  26.   Name = SubStr(Name,3)
  27.   end
  28.  
  29. Name = Directory(Name)
  30. if Name = '' then do
  31.   say "Can't find a directory called" OriginalName
  32.   signal Usage
  33. end
  34.  
  35. fName = FILESPEC('Name', Name)
  36.  
  37. Say "Moving" Name "directory ->" Name"\"fName".Zif"
  38. Say "Use 'WUZ" Name"' to restore or double click on" fName".Zif"
  39.  
  40. '@ren' fName'.Zif' fName'.Zip 2> nul > nul'
  41. '@zip -r -m -u' fName '*'
  42. '@ren' fName'.zip' fName'.zif > nul'
  43. call RxFuncAdd 'SysSetObjectData','RexxUtil','SysSetObjectData'
  44. Call SysSetObjectData Name,"ICONFILE="IconPath"FldZip.Ico"
  45.  
  46. if Dir.2 \= '' then call Directory(Dir.2)
  47. call Directory(Dir.1)
  48.  
  49.  
  50. exit(0)
  51.  
  52.  
  53. Directory: procedure
  54.   arg Name
  55.   if Length(Name) > 3 then
  56.     if Right(Name,1) = '\' then
  57.       Name = Left(Name,LENGTH(Name)-1)
  58.  
  59.   n = 'DIRECTORY'(Name)
  60.   return n
  61.